.class public Lcom/xingbook/ui/XbTextView;
.super Landroid/view/View;


# instance fields
.field public a:Ljava/lang/String;

.field public b:F

.field public c:I

.field public d:Landroid/graphics/Typeface;

.field private e:I

.field private f:I

.field private g:I

.field private h:I

.field private i:Landroid/graphics/Paint;

.field private j:F


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 2

    invoke-direct {p0, p1, p2}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    const v0, -0x555556

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->c:I

    sget-object v0, Landroid/graphics/Typeface;->DEFAULT:Landroid/graphics/Typeface;

    iput-object v0, p0, Lcom/xingbook/ui/XbTextView;->d:Landroid/graphics/Typeface;

    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    const/high16 v0, 0x4220

    const/4 v1, 0x0

    invoke-static {v1}, Lcom/xingbook/c/n;->f(Landroid/app/Activity;)F

    move-result v1

    mul-float/2addr v0, v1

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->b:F

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 2

    invoke-direct {p0, p1, p2, p3}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    const v0, -0x555556

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->c:I

    sget-object v0, Landroid/graphics/Typeface;->DEFAULT:Landroid/graphics/Typeface;

    iput-object v0, p0, Lcom/xingbook/ui/XbTextView;->d:Landroid/graphics/Typeface;

    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    const/high16 v0, 0x4220

    const/4 v1, 0x0

    invoke-static {v1}, Lcom/xingbook/c/n;->f(Landroid/app/Activity;)F

    move-result v1

    mul-float/2addr v0, v1

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->b:F

    return-void
.end method


# virtual methods
.method public getTextHeight()I
    .locals 9

    const/4 v8, 0x1

    const/4 v0, 0x0

    const/4 v2, 0x0

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v3, p0, Lcom/xingbook/ui/XbTextView;->b:F

    invoke-virtual {v1, v3}, Landroid/graphics/Paint;->setTextSize(F)V

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v3, p0, Lcom/xingbook/ui/XbTextView;->c:I

    invoke-virtual {v1, v3}, Landroid/graphics/Paint;->setColor(I)V

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget-object v3, p0, Lcom/xingbook/ui/XbTextView;->d:Landroid/graphics/Typeface;

    invoke-virtual {v1, v3}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    invoke-virtual {v1, v8}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->a:Ljava/lang/String;

    if-nez v1, :cond_0

    iget v0, p0, Lcom/xingbook/ui/XbTextView;->f:I

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->h:I

    add-int/2addr v0, v1

    :goto_0
    return v0

    :cond_0
    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->a:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->toCharArray()[C

    move-result-object v4

    move v1, v2

    move v3, v0

    :goto_1
    array-length v5, v4

    if-lt v0, v5, :cond_1

    add-int/lit8 v0, v3, 0x1

    int-to-float v0, v0

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->b:F

    mul-float/2addr v0, v1

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->h:I

    int-to-float v1, v1

    add-float/2addr v0, v1

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->f:I

    int-to-float v1, v1

    add-float/2addr v0, v1

    float-to-int v0, v0

    goto :goto_0

    :cond_1
    iget-object v5, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    invoke-virtual {v5, v4, v0, v8}, Landroid/graphics/Paint;->measureText([CII)F

    move-result v5

    aget-char v6, v4, v0

    const/16 v7, 0xa

    if-ne v6, v7, :cond_2

    add-int/lit8 v3, v3, 0x1

    move v1, v2

    :goto_2
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    :cond_2
    iget v6, p0, Lcom/xingbook/ui/XbTextView;->j:F

    sub-float/2addr v6, v1

    cmpg-float v6, v6, v5

    if-gez v6, :cond_3

    add-int/lit8 v3, v3, 0x1

    move v1, v2

    :cond_3
    add-float/2addr v1, v5

    goto :goto_2
.end method

.method public getTextWidth()F
    .locals 2

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->c:I

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->b:F

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->d:Landroid/graphics/Typeface;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->a:Ljava/lang/String;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    return v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 11

    const/4 v2, 0x0

    const/4 v3, 0x1

    const/4 v7, 0x0

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->b:F

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->c:I

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    iget-object v1, p0, Lcom/xingbook/ui/XbTextView;->d:Landroid/graphics/Typeface;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    invoke-virtual {v0, v3}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->a:Ljava/lang/String;

    if-nez v0, :cond_1

    :cond_0
    return-void

    :cond_1
    iget-object v0, p0, Lcom/xingbook/ui/XbTextView;->a:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->toCharArray()[C

    move-result-object v1

    move v0, v7

    move v4, v2

    :goto_0
    array-length v5, v1

    if-ge v2, v5, :cond_0

    iget-object v5, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    invoke-virtual {v5, v1, v2, v3}, Landroid/graphics/Paint;->measureText([CII)F

    move-result v10

    aget-char v5, v1, v2

    const/16 v6, 0xa

    if-ne v5, v6, :cond_2

    add-int/lit8 v4, v4, 0x1

    move v0, v7

    :goto_1
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_2
    iget v5, p0, Lcom/xingbook/ui/XbTextView;->j:F

    sub-float/2addr v5, v0

    cmpg-float v5, v5, v10

    if-gez v5, :cond_3

    add-int/lit8 v4, v4, 0x1

    move v8, v7

    move v9, v4

    :goto_2
    iget v0, p0, Lcom/xingbook/ui/XbTextView;->e:I

    int-to-float v0, v0

    add-float v4, v0, v8

    int-to-float v0, v9

    iget v5, p0, Lcom/xingbook/ui/XbTextView;->b:F

    mul-float/2addr v0, v5

    iget v5, p0, Lcom/xingbook/ui/XbTextView;->f:I

    int-to-float v5, v5

    add-float/2addr v0, v5

    iget-object v5, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    invoke-virtual {v5}, Landroid/graphics/Paint;->getFontMetrics()Landroid/graphics/Paint$FontMetrics;

    move-result-object v5

    iget v5, v5, Landroid/graphics/Paint$FontMetrics;->ascent:F

    sub-float v5, v0, v5

    iget-object v6, p0, Lcom/xingbook/ui/XbTextView;->i:Landroid/graphics/Paint;

    move-object v0, p1

    invoke-virtual/range {v0 .. v6}, Landroid/graphics/Canvas;->drawText([CIIFFLandroid/graphics/Paint;)V

    add-float v0, v8, v10

    move v4, v9

    goto :goto_1

    :cond_3
    move v8, v0

    move v9, v4

    goto :goto_2
.end method

.method public setPadding(IIII)V
    .locals 2

    iput p1, p0, Lcom/xingbook/ui/XbTextView;->e:I

    iput p3, p0, Lcom/xingbook/ui/XbTextView;->g:I

    iput p2, p0, Lcom/xingbook/ui/XbTextView;->f:I

    iput p4, p0, Lcom/xingbook/ui/XbTextView;->h:I

    iget v0, p0, Lcom/xingbook/ui/XbTextView;->j:F

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->e:I

    int-to-float v1, v1

    sub-float/2addr v0, v1

    iget v1, p0, Lcom/xingbook/ui/XbTextView;->g:I

    int-to-float v1, v1

    sub-float/2addr v0, v1

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->j:F

    return-void
.end method

.method public setWidth(I)V
    .locals 2

    iget v0, p0, Lcom/xingbook/ui/XbTextView;->j:F

    int-to-float v1, p1

    add-float/2addr v0, v1

    iput v0, p0, Lcom/xingbook/ui/XbTextView;->j:F

    return-void
.end method
